<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //  借用原型来继承构造函数中的属性和方法
    function Father(uname, age) {
      this.uname = uname;
      this.age = age;
    }
    Father.prototype.money = function () {
      console.log('100万');
    }

    function Son(uname, age) {
      Father.call(this, uname, age);
    }
    Son.prototype = new Father();
    Son.prototype.constructor = Son;
    Son.prototype.score = function () {
      console.log('考试');
    }
    var xm = new Son('小明', 12)
    console.log(xm);
    xm.money();

    console.log(new Father('张三丰', 100));
  </script>
</body>

</html>